package com.grace.web.controller.cms;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.grace.cms.forum.record.domain.CmsCollectRecord;
import com.grace.cms.forum.record.domain.CmsLikeRecord;
import com.grace.cms.forum.record.domain.CmsNastyRecord;
import com.grace.cms.forum.record.domain.CmsScoreRecord;
import com.grace.cms.forum.record.domain.CmsShareRecord;
import com.grace.cms.forum.record.service.impl.CmsRecordServiceImpl;
import com.grace.system.controller.UserBaseController;
import com.grace.common.core.page.TableDataInfo;
import com.grace.cms.common.domain.entity.CmsRecordCount;
import com.grace.cms.common.domain.entity.CmsLookRecord;

/**
 * 记录Controller
 * 
 */
@Controller
@RequestMapping("/cms/record")
public class CmsRecordController extends UserBaseController {

    @Autowired
    private CmsRecordServiceImpl recordService;

    /**
     * 
     * @param cmsRecordCount
     * @return
     */
    @PreAuthorize("@ss.hasPermi('cms:record:list')")
    @GetMapping("/count")
    @ResponseBody
    public TableDataInfo list(CmsRecordCount cmsRecordCount) {
        startPage();
        List<CmsRecordCount> list = recordService.listCmsRecordCount(cmsRecordCount.getRecordId(),cmsRecordCount.getThemeName(),cmsRecordCount.getOnlyCode());
        return getDataTable(list);
    }



    /**
     * 
     * @param lookRecord
     * @return
     */
    @PreAuthorize("@ss.hasPermi('cms:record:look')")
    @GetMapping("/look")
    @ResponseBody
    public TableDataInfo lookRecord(CmsLookRecord lookRecord) {
        startPage();
        List<CmsLookRecord> list = recordService.listLookRecord(lookRecord);
        return getDataTable(list);
    }

    /**
     * 
     * @param likeRecord
     * @return
     */
    @PreAuthorize("@ss.hasPermi('cms:record:like')")
    @GetMapping("/like")
    @ResponseBody
    public TableDataInfo likeRecord(CmsLikeRecord likeRecord) {
        startPage();
        List<CmsLikeRecord> list = recordService.listLikeRecord(likeRecord);
        return getDataTable(list);
    }

    /**
     * 
     * @param collectRecord
     * @return
     */
    @PreAuthorize("@ss.hasPermi('cms:record:collect')")
    @GetMapping("/collect")
    @ResponseBody
    public TableDataInfo collectRecord(CmsCollectRecord collectRecord) {
        startPage();
        List<CmsCollectRecord> list = recordService.listCollectRecord(collectRecord);
        return getDataTable(list);
    }

    /**
     * 
     * @param shareRecord
     * @return
     */
    @PreAuthorize("@ss.hasPermi('cms:record:share')")
    @GetMapping("/share")
    @ResponseBody
    public TableDataInfo shareRecord(CmsShareRecord shareRecord) {
        startPage();
        List<CmsShareRecord> list = recordService.listShareRecord(shareRecord);
        return getDataTable(list);
    }

    /**
     * 
     * @param nastyRecord
     * @return
     */
    @PreAuthorize("@ss.hasPermi('cms:record:nasty')")
    @GetMapping("/nasty")
    @ResponseBody
    public TableDataInfo nastyRecord(CmsNastyRecord nastyRecord) {
        startPage();
        List<CmsNastyRecord> list = recordService.listNastyRecord(nastyRecord);
        return getDataTable(list);
    }

    /**
     * 
     * @param scoreRecord
     * @return
     */
    @PreAuthorize("@ss.hasPermi('cms:record:score')")
    @GetMapping("/score")
    @ResponseBody
    public TableDataInfo scoreRecord(CmsScoreRecord scoreRecord) {
        startPage();
        List<CmsScoreRecord> list = recordService.listScoreRecord(scoreRecord);
        return getDataTable(list);
    }

}
